from PyQt5.QtWidgets import *       #部件，控件相关
from PyQt5.QtGui import *           #图片相关
from PyQt5.QtCore import *          #事件相关(鼠标等事件)

import sys         

from ui.Ui_sub_widget import Ui_SubWidget                 

#自定义窗口，继承窗口
class Sub_Widget(QWidget):
    
    #定义信号对象，参数要带数据类型
    signal_1 = pyqtSignal(int,str)
    signal_2 = pyqtSignal()
    
    
    def __init__(self, parent=None):
        super().__init__(parent)
        
        self.ui = Ui_SubWidget()
        self.ui.setupUi(self)

        self.init_ui()

    def init_ui(self):
        #绑定按钮的信号和槽
        self.ui.btn1.clicked.connect(lambda: self.signal_1.emit(1,'hello'))
        self.ui.btn2.clicked.connect(lambda: self.signal_2.emit())
    